/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.model;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author Suporte
 */
@Entity
@Table(name = "setor", catalog = "bancosysepi", schema = "")
@NamedQueries({
    @NamedQuery(name = "Setor.findAll", query = "SELECT s FROM Setor s"),
    @NamedQuery(name = "Setor.findByIdTBSetor", query = "SELECT s FROM Setor s WHERE s.idTBSetor = :idTBSetor"),
    @NamedQuery(name = "Setor.findByNomeSetor", query = "SELECT s FROM Setor s WHERE s.nomeSetor = :nomeSetor"),
    @NamedQuery(name = "Setor.findByDescricaoSetor", query = "SELECT s FROM Setor s WHERE s.descricaoSetor = :descricaoSetor"),
    @NamedQuery(name = "Setor.findByResponsavelSetor", query = "SELECT s FROM Setor s WHERE s.responsavelSetor = :responsavelSetor"),
    @NamedQuery(name = "Setor.findByRiscoSetor", query = "SELECT s FROM Setor s WHERE s.riscoSetor = :riscoSetor"),
    @NamedQuery(name = "Setor.findByObservacoesSetor", query = "SELECT s FROM Setor s WHERE s.observacoesSetor = :observacoesSetor")})
public class Setor implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idTBSetor")
    private Integer idTBSetor;
    @Column(name = "nome_setor")
    private String nomeSetor;
    @Column(name = "descricao_setor")
    private String descricaoSetor;
    @Column(name = "responsavel_setor")
    private String responsavelSetor;
    @Column(name = "risco_setor")
    private String riscoSetor;
    @Column(name = "observacoes_setor")
    private String observacoesSetor;

    public Setor() {
    }

    public Setor(Integer idTBSetor) {
        this.idTBSetor = idTBSetor;
    }

    public Integer getIdTBSetor() {
        return idTBSetor;
    }

    public void setIdTBSetor(Integer idTBSetor) {
        Integer oldIdTBSetor = this.idTBSetor;
        this.idTBSetor = idTBSetor;
        changeSupport.firePropertyChange("idTBSetor", oldIdTBSetor, idTBSetor);
    }

    public String getNomeSetor() {
        return nomeSetor;
    }

    public void setNomeSetor(String nomeSetor) {
        String oldNomeSetor = this.nomeSetor;
        this.nomeSetor = nomeSetor;
        changeSupport.firePropertyChange("nomeSetor", oldNomeSetor, nomeSetor);
    }

    public String getDescricaoSetor() {
        return descricaoSetor;
    }

    public void setDescricaoSetor(String descricaoSetor) {
        String oldDescricaoSetor = this.descricaoSetor;
        this.descricaoSetor = descricaoSetor;
        changeSupport.firePropertyChange("descricaoSetor", oldDescricaoSetor, descricaoSetor);
    }

    public String getResponsavelSetor() {
        return responsavelSetor;
    }

    public void setResponsavelSetor(String responsavelSetor) {
        String oldResponsavelSetor = this.responsavelSetor;
        this.responsavelSetor = responsavelSetor;
        changeSupport.firePropertyChange("responsavelSetor", oldResponsavelSetor, responsavelSetor);
    }

    public String getRiscoSetor() {
        return riscoSetor;
    }

    public void setRiscoSetor(String riscoSetor) {
        String oldRiscoSetor = this.riscoSetor;
        this.riscoSetor = riscoSetor;
        changeSupport.firePropertyChange("riscoSetor", oldRiscoSetor, riscoSetor);
    }

    public String getObservacoesSetor() {
        return observacoesSetor;
    }

    public void setObservacoesSetor(String observacoesSetor) {
        String oldObservacoesSetor = this.observacoesSetor;
        this.observacoesSetor = observacoesSetor;
        changeSupport.firePropertyChange("observacoesSetor", oldObservacoesSetor, observacoesSetor);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idTBSetor != null ? idTBSetor.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Setor)) {
            return false;
        }
        Setor other = (Setor) object;
        if ((this.idTBSetor == null && other.idTBSetor != null) || (this.idTBSetor != null && !this.idTBSetor.equals(other.idTBSetor))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.com.view.Setor[ idTBSetor=" + idTBSetor + " ]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
    
}
